import request from '@/util/request'

// 获取主账号列表
export function listMainAccount () {
  return request({
    url: '/mePushToOtherNotAdopt/loadMainList.json',
    method: 'get',
    baseURL: process.env.VUE_APP_AJS_MALL
  })
}

// 获取我为他未采纳列表
export function listNotAdopted (pageParams, data) {
  const { index, size } = pageParams
  const { mainId, orderBatch } = data
  return request({
    url: `/mePushToOtherNotAdopt/list/${index}/${size}.json`,
    method: 'get',
    headers: {
      mainId: mainId,
      orderBatch: orderBatch
    },
    baseURL: process.env.VUE_APP_AJS_MALL
  })
}

// 获取我为他未采纳详情主要信息
export function getPushMainDetail (orderBatch) {
  return request({
    url: `/mePushToOtherNotAdopt/mainDetail/${orderBatch}.json`,
    method: 'get',
    baseURL: process.env.VUE_APP_AJS_MALL
  })
}

// 获取我为他未采纳详情商品信息
export function listProductDetail (orderBatch) {
  return request({
    url: `/mePushToOtherNotAdopt/listPushProduct/${orderBatch}.json`,
    method: 'get',
    baseURL: process.env.VUE_APP_AJS_MALL
  })
}

// 清除授权关系已解除的预选单
export function clearPreOrder () {
  return request({
    url: '/mePushToOtherNotAdopt/hidePushMainBatch.json',
    method: 'post',
    baseURL: process.env.VUE_APP_AJS_MALL
  })
}

// 删除预选单
export function deletePushMain (orderBatch) {
  return request({
    url: `/mePushToOtherNotAdopt/deletePushMain/${orderBatch}.json`,
    method: 'delete',
    baseURL: process.env.VUE_APP_AJS_MALL
  })
}

// 计算运费
export function freight (data) {
  return request({
    url: 'mePushToOtherNotAdopt/freight.json',
    method: 'POST',
    data,
    baseURL: process.env.VUE_APP_AJS_MALL
  })
}
